package org.linlinjava.litemall.db.service;

import org.linlinjava.litemall.db.dao.LitemallVoucherCommentMapper;
import org.linlinjava.litemall.db.domain.LitemallVoucherComment;
import org.linlinjava.litemall.db.domain.LitemallVoucherCommentExample;
import org.linlinjava.litemall.db.domain.LitemallVoucherCommentVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Service
public class LitemallVoucherCommentService {
    @Resource
    private LitemallVoucherCommentMapper voucherCommentMapper;

    //查询一个订单的评价数量
    public int countWithOrderId(Integer orderId){
        LitemallVoucherCommentExample example = new LitemallVoucherCommentExample();
        example.or().andOrderIdEqualTo(orderId);
        return (int)voucherCommentMapper.countByExample(example);
    }
    public List<LitemallVoucherCommentVo> voucherCommentList(Integer mechanismId) {
        return voucherCommentMapper.selectByMechanismId(mechanismId);
    }
     public Integer save(LitemallVoucherComment voucherComment) {
        return voucherCommentMapper.insertSelective(voucherComment);
    }
    public List<LitemallVoucherCommentVo> voucherCommentVoAllList(Integer mechanismId){
        return  voucherCommentMapper.selectAllByMId(mechanismId);
    }
}